{literal}
<h2>Annotation</h2>

<b>@orm has|owns many|children|parents $className [inverse $inverse] [itemValidator $itemValidator()] [counter $counter]<br></b>

<h2> Simple Many to many relation </h2>
<h3>Source</h3>
<pre class="code">
&lt;?php
class MyParent extends DomArObject {
	/**
	* @orm has children MyChild inverse parents 
	*/
	private $children;		
}
			
class MyChild extends DomArObject {				
	/**
	* @orm has parents MyParent inverse children
	*/
	private $parents;			
}
?&gt;
</pre>
<h3>Using</h3>
<pre class="code">
&lt;?php
$parent1 = new MyParent();
$parent2 = new MyParent();
$child1 = new MyChild();
$child2 = new MyChild();

$parent1->children[] = $child1;
$parent1->children[] = $child2;

$parent2->children[] = $child1;

$parent->save();
	
//Accessing children and parents

$parent = MyParent::load( $parent1->id );
foreach( $parent->children as $child ) {
	// do something
}

$child = MyChild::load( $child1->id );
foreach( $child->parents as $parent ) {
	// do something
}
?&gt;
</pre>


<h2>Item validator and listeners</h2>
See One to many relationship. They are same for many to many!<br>
{/literal}